package easymall.controller.admin;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import easymall.po.Category;
import easymall.po.CategoryNum;
import easymall.service.CategoryNumService;

@Controller("categoryNumController")
@RequestMapping("/Echarts")
public class CategoryNumController {
	@Autowired
	private CategoryNumService categoryNumService;
	@RequestMapping("/getCategory")
	@ResponseBody
	public List<CategoryNum> toCharts() {
		List<CategoryNum> categoryNumList = categoryNumService.findCategoryNum();
		for(CategoryNum categorynum : categoryNumList) {
			categorynum.setName(categoryNumService.findCategoryName(categorynum).getName());
		}
        return categoryNumList;
	}
	
	@RequestMapping("/showBar")
	public String showBar() {
		return "admin/showEchartsBar";
	}
	
	@RequestMapping("/showPie")
	public String showPie() {
		return "admin/showEchartsPie";
	}
}
